Imports System.Collections.Generic
Imports System.Linq
Imports System.Web

#Region "using"
Imports System.Data
Imports QUANLY.DTO
#End Region
Public Class LOAINGUOIDUNGDAO
	Inherits AbstractDAO
	Public Sub New(strPath As [String])
		MyBase.New(strPath)
	End Sub

	Public Function SelectAll() As DataSet
		Dim ds As DataSet
		Try
			ds = New DataSet()
			MyBase.sql = "usp_LOAINGUOIDUNG_SelectAll"
			MyBase.FillDataSet(ds, "LOAINGUOIDUNG")
			Return ds
		Catch e As System.Exception
			Throw New Exception(e.Message, e.InnerException)
		Finally
			MyBase.CleanUpObject()
		End Try
	End Function

	Public Function SelectByID(id As Integer) As DataSet
		Dim ds As DataSet
		Try
			ds = New DataSet()
			MyBase.sql = "usp_LOAINGUOIDUNG_SelectByID"
			MyBase.InitializeCommand()
			MyBase.AddParameter("@ID", SqlDbType.Int, 1000, id)
			MyBase.FillDataSet(ds, "LOAINGUOIDUNG")
			Return ds
		Catch e As System.Exception
			Throw New Exception(e.Message, e.InnerException)
		Finally
			MyBase.CleanUpObject()
		End Try
	End Function

	Public Function Insert(obj As LOAINGUOIDUNGDTO) As Boolean
		Try
			MyBase.sql = "usp_LOAINGUOIDUNG_Insert"
			MyBase.InitializeCommand()
			MyBase.AddParameter("@TenLoaiNguoiDung", SqlDbType.NVarChar, 1000, obj.TenLoaiNguoiDung)
			Return ExecuteStoredProcedure()
		Catch
			Return False
		End Try
	End Function

	Public Function Update(obj As LOAINGUOIDUNGDTO) As Boolean
		Try
			MyBase.sql = "usp_LOAINGUOIDUNG_Update"
			MyBase.InitializeCommand()
			MyBase.AddParameter("@ID", SqlDbType.Int, 1000, obj.ID)
			MyBase.AddParameter("@TenLoaiNguoiDung", SqlDbType.NVarChar, 1000, obj.TenLoaiNguoiDung)
			Return ExecuteStoredProcedure()
		Catch
			Return False
		End Try
	End Function

	Public Function Delete(id As Integer) As Boolean
		Try
			MyBase.sql = "usp_LOAINGUOIDUNG_Delete"
			MyBase.InitializeCommand()
			MyBase.AddParameter("@ID", SqlDbType.Int, 1000, id)
			Return ExecuteStoredProcedure()
		Catch
			Return False
		End Try
	End Function

End Class
